package top.ckxgzxa.newscms.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.ckxgzxa.newscms.domain.ResponseResult;
import top.ckxgzxa.newscms.entity.User;
import top.ckxgzxa.newscms.service.LoginService;
import top.ckxgzxa.newscms.service.UserService;

/**
 * @author 赵希奥
 * @date 2022/5/28 1:28
 * @gitHub https://github.com/CKXGZXA
 * @gitee https://gitee.com/ckxgzxa
 * @description:
 */
@RestController
public class LoginController {

    @Autowired
    private LoginService loginService;

    @PostMapping("/user/login")
    public ResponseResult login(@RequestBody User user) {
        // 登录
        return loginService.login(user);
    }

    @RequestMapping("/user/logout")
    public ResponseResult logout() {
        // 登出
        return loginService.logout();
    }

}
